Repository navigation
fix(worker): propagate batch token logprobs through CompletionOutlet - #898
Merged
Merged
Conversation
CompletionOutlet.gather_completed_tokens and report_completion were introduced after the batch-logprobs path and omitted _batch_logprobs gathering, cross-rank merging, response-queue emission, and per-rank cleanup. Any batch request with logprobs that completed during decode (max_completion_tokens >= 2) went through BoundaryExecutor -> CompletionOutlet and failed with invalid_worker_logprobs. Pass batch_logprobs into CompletionOutlet, mirror the gather/merge/pop protocol identically to BatchGenWorker, guard self-merge and already- completed decode rows in _select_tokens, and add unit tests covering cross-rank merge and non-zero rank cleanup.
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Wire
_batch_logprobsthroughCompletionOutlet.gather_completed_tokensandCompletionOutlet.report_completion, matchingBatchGenWorker._gather_completed_tokens/_report_completion.Motivation
CompletionOutletwas extracted after the batch-logprobs path and omitted cross-rank logprob gathering, merging on rank 0,token_logprobsemission in the completion payload, and per-rank cleanup. Consequently, any batch API request withlogprobsthat completed during decode (routed viaBoundaryExecutor->CompletionOutlet) failed withinvalid_worker_logprobs: expected logprobs for all N generated tokens.This fix also skips redundant
history.stage(...)calls in_select_tokensfor already-completed rows waiting for the next page boundary and guards self-merge whenrecords is history.records.Type of Change
fix— narrow bug fix (+ a regression test)File changes
batchgen/worker/completion.pybatch_logprobsfield toCompletionOutlet; gather, merge on rank 0, emittoken_logprobs, and pop per-rank history on completionbatchgen/batchgen_worker.py_batch_logprobstoCompletionOutlet, guard self-merge, and skip staging for already-completed rows in_select_tokenstests/unit/server/test_batch_logprobs.pyCompletionOutletcross-rank gather/merge/emit and non-zero rank cleanupChecklist
README.mdchanged, I ranpython3 scripts/check_readme_update.py --base-ref origin/mainand preserved all News history.